package com.ly.pj.goods.service;
import com.ly.pj.goods.dao.GoodsDao;
import com.ly.pj.goods.pojo.Goods;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 门面模式：对外提供接口
 * import org.slf4j.Logger;
 * import org.slf4j.LoggerFactory;
 */
@Service//描述业务层逻辑对象，描述的类交给spring管理
public class GoodsServiceImp implements GoodsService{
    //参数为log对象所在类的类名.class
    private static final Logger logger = LoggerFactory.getLogger(GoodsServiceImp.class);
    @Autowired
    private GoodsDao goodsDao;
    @Override
    public List<Goods> findGoods() {
        long startTime=System.currentTimeMillis();
        List<Goods> list=goodsDao.findGoods();
        long endTime=System.currentTimeMillis();
        //System.out.println("time="+(endTime-startTime));
        logger.info("findGoods() --> time:{}",endTime-startTime);
        return list;
    }
}
